<?php
class customerCacheAuctionBidInfo extends CRedisModel{
	const CUSTOMER_AUCTION_BIDINFO_PRE='customerBidInfo';
	public $customerId;
	public $auctionId;
	
	public function getPrimaryKey(){
		return self::CUSTOMER_AUCTION_BIDINFO_PRE.':'.$this->auctionId.':'.$this->customerId;
	}
	
	public function addItem($key,$value){
		return $this->redis()->hSet($this->getPrimaryKey(),$key,$value);	
	}
	
	public function addItems($items){
		return $this->redis()->hMSet($this->getPrimaryKey(),$items);
	}
	
	public function delItem($key){
		return $this->redis()->hDel($this->getPrimaryKey(),$key);
	}
	
	public function getItems(){
		return $this->redis()->hGetAll ($this->getPrimaryKey());
	}
	
	public function delItems($pk){
		$allKeys=$this->redis()->getKeys(self::CUSTOMER_AUCTION_BIDINFO_PRE.':'.$pk.'*');
		if (!empty($allKeys)) {
			foreach ($allKeys as $key){
				$this->redis()->del($key);
			}
		}	
	}
}